package week08.company;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by zhangxiaokun on 2018/3/20.
 */
public class President implements Mediator {
    private Map<String, Department> departmentMap = new HashMap<>();

    @Override
    public void register(String dname, Department department) {
        if ( !departmentMap.containsKey(dname)) {
            departmentMap.put(dname, department);
        }
    }

    @Override
    public void command(String dname) {
        if (departmentMap.containsKey(dname)) {
//            System.out.println(dname + "---> President");
            departmentMap.get(dname).selfAction();
        }
    }
}


//-------2018.03.22 20:45